/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package drinkcounter.web.servlet;

import drinkcounter.model.Participant;
import drinkcounter.model.Participant.Sex;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Toni
 */
public class ParticipantHelper {

    public static Participant parseNewParticipant(HttpServletRequest req){
        Participant participant = new Participant();
        participant.setName(req.getParameter("name"));
        participant.setWeight(Float.parseFloat(req.getParameter("weight")));
        participant.setSex(Sex.valueOf(req.getParameter("sex")));
        return participant;
    }
}
